package com.kiki.stater.upload;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * Created by mazeyi on 2021/1/28.
 */
@Controller
@RequestMapping
public class UploadController {

    @RequestMapping("/mutipartUpload")
    public void upload1(MultipartFile multipartFile){
        String path = "E:\\upload\\";
        String fileName = multipartFile.getOriginalFilename();

        File file = new File(path + fileName);
        long startTime = System.currentTimeMillis();
        try {
            multipartFile.transferTo(file);
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println(System.currentTimeMillis() - startTime);


    }
}